package leecode;

/**
 * @author cloudJiang
 * @date 2021/10/23 18:03
 */
public class Num492 {
    public static void main(String[] args) {
        for (int i : constructRectangle(10154)) {
            System.out.println(i);
        }
    }

    public static int[] constructRectangle(int area) {
        //rectangle[0] means length
        //rectangle[1] means weight
        int length = 0;
        int weight = 0;
        int[] rectangle;

        weight = (int) Math.sqrt(area);
        if (weight * weight == area) {
            rectangle = new int[]{weight, weight};
        } else {
            while (area % weight != 0) {
                weight--;
            }
            length = area / weight;
            rectangle = new int[]{length, weight};
        }
        return rectangle;
    }
}
